import { createRouter, createWebHashHistory } from 'vue-router'
import Layout from '@/views/Layout/Layout.vue'
const router = createRouter({
  history: createWebHashHistory(),
  scrollBehavior: () => {
    return {
      top: 0
    }
  },
  routes: [
    {
      path: '/',
      component: Layout,
      children: [
        {
          path: '',
          component: () => import('@/views/Home/Home.vue')
        },
        {
          path: '/category/:id',
          component: () => import('@/views/Category/Category.vue')
        },
        {
          path: '/goods/:id',
          component: () => import('@/views/Goods/Goods.vue')
        },
        {
          path: '/cart',
          component: () => import('@/views/Cart/Cart.vue')
        }
      ]
    },
    {
      path: '/login',
      component: () => import('@/views/Login/Login.vue')
    },
    {
      path: '/login/callback',
      component: () => import('@/views/Login/LoginCallback.vue')
    },
    {
      path: '/member/checkout',
      component: () => import('@/views/Member/Checkout.vue')
    },
    {
      path: '/member/pay',
      component: () => import('@/views/Member/Pay.vue')
    },
    {
      path: '/pay/callback',
      component: () => import('@/views/Member/PayBack.vue')
    }
  ]
})
export default router
